open(BUFF,"GenomeWideSNP_6.na32.annot.csv");
while(<BUFF>)
{
	chomp($_);
	$_ =~ s/"//g;
	@array = split(',',$_);
	if($_ =~ m/^SNP/)
	{
		#print "$array[0]\t$array[1]\n";
		$hash{$array[0]}=$array[1];
	}
}
open(BUFF,"gain_all_toimpute1.bim") or die "no file gain_all_toimpute.bim\n";
open(WRBUFF,">gain_all_toimpute.bim") or die "not able to write gain_all_toimpute.bim\n";
open(WRBUFF1,">forward_strand") or die "not able to write forward_strand\n";
while(<BUFF>)
{
	chomp($_);
	@array=split("\t",$_);
	if(exists($hash{$array[1]}))
	{
		$array[1]=$hash{$array[1]};
		if(($array[4] eq "A" &&  $array[5] eq "T") || ($array[4] eq "T" &&  $array[5] eq "A") || ($array[4] eq "C" &&  $array[5] eq "G") || ($array[4] eq "G" &&  $array[5] eq "C"))
		{
			print WRBUFF1	$array[1]."\t"."2"."\n";
		}
	}
	else
	{
		die "$array[1]\n";
	}
	$_ = join("\t",@array);
	#print "$_\n";
	print WRBUFF "$_\n";
}
